﻿package mortal.game.view.common.guide.stepOperater
{
    import mortal.common.*;
    import mortal.component.window.*;
    import mortal.game.events.*;
    import mortal.game.manager.*;
    import mortal.game.mvc.*;
    import mortal.game.view.common.guide.data.*;
    import mortal.mvc.core.*;

    public class AutoGuideCloseWinSteper extends AutoGuideStepBase implements IAutoGuideSteper
    {

        public function AutoGuideCloseWinSteper()
        {
            return;
        }// end function

        public function guide(param1:AutoGuideData, param2:Window = null) : void
        {
            if (param1 == null)
            {
                this.stop(param1);
                return;
            }
            if (param2 == null)
            {
                param2 = DisplayUtil.getChildByPropety(LayerManager.windowLayer, "winTitleName", param1.guideTypeValue) as Window;
            }
            if (param2 == null)
            {
                param2 = DisplayUtil.getChildByPropety(LayerManager.windowLayer3D, "winTitleName", param1.guideTypeValue) as Window;
            }
            if (param2 == null)
            {
                param2 = DisplayUtil.getChildByPropety(LayerManager.fullScreenLayer, "winTitleName", param1.guideTypeValue) as Window;
            }
            if (param2 == null)
            {
                param2 = DisplayUtil.getChildByPropety(LayerManager.fullScreenTopLayer, "winTitleName", param1.guideTypeValue) as Window;
            }
            if (param2 == null)
            {
                this.stop(param1);
                return;
            }
            param2.hide();
            this.stop(param1);
            return;
        }// end function

        override public function stop(param1:AutoGuideData = null) : void
        {
            super.stop(param1);
            if (param1 != null)
            {
                Dispatcher.dispatchEvent(new DataEvent(EventName.AutoGuideStepEnd, param1));
            }
            return;
        }// end function

    }
}
